define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'clipboard'], function ($, undefined, Backend, Table, Form, ClipboardJS) {

    var Controller = {
        index: function () {



            $('#reset-credit-pass').click(function () {
                // document.getElementById("z-app-secret").innerText = "Hello,World!";
                //  console.log();
                // $("#secret").html("6666666666")
                //$("#z-app-secret").html() = "test";
                // return

                layer.confirm('确定要重置吗？重置并提交保存后原key将失效无法使用！！！', {
                    icon: 7,
                    title: '提示'
                }, function (index) {
                    layer.close(index);
                    var index2 = layer.load();
                    $.post("openapi/setting/createSecret", {}, function (result) {
                        layer.close(index2);
                        //$('#z-app-secret').val(result.data);
                        layer.alert('请妥善保存该Key，关闭后将不再展示，提交保存后生效<br/>' +
                            '<button type="button" data-clipboard-text="' + result.data + '"' +
                            'data-toggle="tooltip" class="btn btn-xs btn-default copy"\n' +
                            'data-title="点击复制">' + result.data +
                            '</button>');
                    });
                });
            });



            //购买页面
            $(document).on('click', '.btn-doc', function (event) {
                var url = 'https://console-docs.apipost.cn/preview/63d61ff5c609f6ba/c629bbf6e32e9da2?target_id=8a327f8e-5adc-42a2-badd-51c0f0a8a086';

                var msg = '开放平台文档';

                var area = ['95%', '85%'];
                var options = {
                    shadeClose: false,
                    shade: [0.3, '#393D49'],
                    area: area,
                    callback: function () {}
                };
                Fast.api.open(url, msg, options);
            });

            Controller.api.bindevent();
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});